package com.fwtai.web;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 通知|公告访问数据库
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2021-08-24 16:23:58
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class InformDao{

    @Resource
    private DaoHandle dao;

    public int add(final PageFormData formData){
        return dao.execute("inform.add",formData);
    }

    public String queryExistById(final String kid){
        return dao.queryForString("inform.queryExistById",kid);
    }

    public int edit(final PageFormData formData){
        return dao.execute("inform.edit",formData);
    }

    public HashMap<String, Object> queryById(final String kid){
        return dao.queryForHashMap("inform.queryById",kid);
    }

    public int delById(final String kid){
        return dao.execute("inform.delById",kid);
    }

    public int delByKeys(final ArrayList<String> list){
        return dao.execute("inform.delByKeys",list);
    }

    public HashMap<String,Object> listData(final PageFormData formData){
        return dao.queryForPage(formData,"inform.listData","inform.listTotal");
    }

    public List<Map<String, Object>> getListData(final PageFormData formData){
        return dao.queryForListMap("inform.listData",formData);
    }

    public Integer getListTotal(final PageFormData formData){
        return dao.queryForInteger("inform.listTotal",formData);
    }
}